#define _GNU_SOURCE 

#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>

#include <sys/param.h>


#include "config/config.h"




char *
chemin_correct(char* path_www)//, char *path_demande){
{
  char *path = malloc(sizeof(char)*(strlen(ROOT)+ strlen(path_www)+ 1));
  strcpy(path, ROOT);

  printf("path www = %s size de path = %d\n",path_www, strlen(path_www));
  
  strcat(path,path_www);
  
  printf("%s\n",path);

  char path_demande[BUFFER_SIZE];

  char *res= realpath (path,  path_demande);

  printf("res = %s\n",res);

  free(path);
  path = NULL;

  printf("path freed : %s\n",path);

  return res;
}


/*int
main(int argc,char* argv[])
{
  char www[]="/";
  char *res=  chemin_correct(www);
  
  printf("le chemin demandé est %s\n",res);
  return EXIT_SUCCESS;
  }*/
